home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / src / gdb-4.12 / include / coff / i386.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-03  |  5.5 KB  |  222 lines

  1. /*** coff information for Intel 386/486.  */
  2.  
  3.  
  4. /********************** FILE HEADER **********************/
  5.  
  6. struct external_filehdr {
  7.     char f_magic[2];    /* magic number            */
  8.     char f_nscns[2];    /* number of sections        */
  9.     char f_timdat[4];    /* time & date stamp        */
  10.     char f_symptr[4];    /* file pointer to symtab    */
  11.     char f_nsyms[4];    /* number of symtab entries    */
  12.     char f_opthdr[2];    /* sizeof(optional hdr)        */
  13.     char f_flags[2];    /* flags            */
  14. };
  15.  
  16.  
  17. /* Bits for f_flags:
  18.  *    F_RELFLG    relocation info stripped from file
  19.  *    F_EXEC        file is executable (no unresolved external references)
  20.  *    F_LNNO        line numbers stripped from file
  21.  *    F_LSYMS        local symbols stripped from file
  22.  *    F_AR32WR    file has byte ordering of an AR32WR machine (e.g. vax)
  23.  */
  24.  
  25. #define F_RELFLG    (0x0001)
  26. #define F_EXEC        (0x0002)
  27. #define F_LNNO        (0x0004)
  28. #define F_LSYMS        (0x0008)
  29.  
  30.  
  31.  
  32. #define    I386MAGIC    0x14c
  33. #define I386PTXMAGIC    0x154
  34. #define I386AIXMAGIC    0x175
  35.  
  36. /* This is Lynx's all-platform magic number for executables. */
  37.  
  38. #define LYNXCOFFMAGIC    0415
  39.  
  40. #define I386BADMAG(x) (((x).f_magic != I386MAGIC) \
  41.                && (x).f_magic != I386AIXMAGIC \
  42.                && (x).f_magic != I386PTXMAGIC \
  43.                && (x).f_magic != LYNXCOFFMAGIC)
  44.  
  45. #define    FILHDR    struct external_filehdr
  46. #define    FILHSZ    sizeof(FILHDR)
  47.  
  48.  
  49. /********************** AOUT "OPTIONAL HEADER" **********************/
  50.  
  51.  
  52. typedef struct 
  53. {
  54.   char     magic[2];        /* type of file                */
  55.   char    vstamp[2];        /* version stamp            */
  56.   char    tsize[4];        /* text size in bytes, padded to FW bdry*/
  57.   char    dsize[4];        /* initialized data "  "        */
  58.   char    bsize[4];        /* uninitialized data "   "        */
  59.   char    entry[4];        /* entry pt.                */
  60.   char     text_start[4];        /* base of text used for this file */
  61.   char     data_start[4];        /* base of data used for this file */
  62. }
  63. AOUTHDR;
  64.  
  65.  
  66. #define AOUTSZ (sizeof(AOUTHDR))
  67.  
  68. #define OMAGIC          0404    /* object files, eg as output */
  69. #define ZMAGIC          0413    /* demand load format, eg normal ld output */
  70. #define STMAGIC        0401    /* target shlib */
  71. #define SHMAGIC        0443    /* host   shlib */
  72.  
  73.  
  74. /********************** SECTION HEADER **********************/
  75.  
  76.  
  77. struct external_scnhdr {
  78.     char        s_name[8];    /* section name            */
  79.     char        s_paddr[4];    /* physical address, aliased s_nlib */
  80.     char        s_vaddr[4];    /* virtual address        */
  81.     char        s_size[4];    /* section size            */
  82.     char        s_scnptr[4];    /* file ptr to raw data for section */
  83.     char        s_relptr[4];    /* file ptr to relocation    */
  84.     char        s_lnnoptr[4];    /* file ptr to line numbers    */
  85.     char        s_nreloc[2];    /* number of relocation entries    */
  86.     char        s_nlnno[2];    /* number of line number entries*/
  87.     char        s_flags[4];    /* flags            */
  88. };
  89.  
  90. #define    SCNHDR    struct external_scnhdr
  91. #define    SCNHSZ    sizeof(SCNHDR)
  92.  
  93. /*
  94.  * names of "special" sections
  95.  */
  96. #define _TEXT    ".text"
  97. #define _DATA    ".data"
  98. #define _BSS    ".bss"
  99. #define _COMMENT ".comment"
  100. #define _LIB ".lib"
  101.  
  102. /********************** LINE NUMBERS **********************/
  103.  
  104. /* 1 line number entry for every "breakpointable" source line in a section.
  105.  * Line numbers are grouped on a per function basis; first entry in a function
  106.  * grouping will have l_lnno = 0 and in place of physical address will be the
  107.  * symbol table index of the function name.
  108.  */
  109. struct external_lineno {
  110.     union {
  111.         char l_symndx[4];    /* function name symbol index, iff l_lnno == 0*/
  112.         char l_paddr[4];    /* (physical) address of line number    */
  113.     } l_addr;
  114.     char l_lnno[2];    /* line number        */
  115. };
  116.  
  117.  
  118. #define    LINENO    struct external_lineno
  119. #define    LINESZ    6
  120.  
  121.  
  122. /********************** SYMBOLS **********************/
  123.  
  124. #define E_SYMNMLEN    8    /* # characters in a symbol name    */
  125. #define E_FILNMLEN    14    /* # characters in a file name        */
  126. #define E_DIMNUM    4    /* # array dimensions in auxiliary entry */
  127.  
  128. struct external_syment 
  129. {
  130.   union {
  131.     char e_name[E_SYMNMLEN];
  132.     struct {
  133.       char e_zeroes[4];
  134.       char e_offset[4];
  135.     } e;
  136.   } e;
  137.   char e_value[4];
  138.   char e_scnum[2];
  139.   char e_type[2];
  140.   char e_sclass[1];
  141.   char e_numaux[1];
  142. };
  143.  
  144. #define N_BTMASK    (0xf)
  145. #define N_TMASK        (0x30)
  146. #define N_BTSHFT    (4)
  147. #define N_TSHIFT    (2)
  148.   
  149. union external_auxent {
  150.     struct {
  151.         char x_tagndx[4];    /* str, un, or enum tag indx */
  152.         union {
  153.             struct {
  154.                 char  x_lnno[2]; /* declaration line number */
  155.                 char  x_size[2]; /* str/union/array size */
  156.             } x_lnsz;
  157.             char x_fsize[4];    /* size of function */
  158.         } x_misc;
  159.         union {
  160.             struct {        /* if ISFCN, tag, or .bb */
  161.                 char x_lnnoptr[4];    /* ptr to fcn line # */
  162.                 char x_endndx[4];    /* entry ndx past block end */
  163.             } x_fcn;
  164.             struct {        /* if ISARY, up to 4 dimen. */
  165.                 char x_dimen[E_DIMNUM][2];
  166.             } x_ary;
  167.         } x_fcnary;
  168.         char x_tvndx[2];        /* tv index */
  169.     } x_sym;
  170.  
  171.     union {
  172.         char x_fname[E_FILNMLEN];
  173.         struct {
  174.             char x_zeroes[4];
  175.             char x_offset[4];
  176.         } x_n;
  177.     } x_file;
  178.  
  179.     struct {
  180.         char x_scnlen[4];            /* section length */
  181.         char x_nreloc[2];    /* # relocation entries */
  182.         char x_nlinno[2];    /* # line numbers */
  183.     } x_scn;
  184.  
  185.         struct {
  186.         char x_tvfill[4];    /* tv fill value */
  187.         char x_tvlen[2];    /* length of .tv */
  188.         char x_tvran[2][2];    /* tv range */
  189.     } x_tv;        /* info about .tv section (in auxent of symbol .tv)) */
  190.  
  191.  
  192. };
  193.  
  194. #define    SYMENT    struct external_syment
  195. #define    SYMESZ    18    
  196. #define    AUXENT    union external_auxent
  197. #define    AUXESZ    18
  198.  
  199.  
  200. #    define _ETEXT    "etext"
  201.  
  202.  
  203. /********************** RELOCATION DIRECTIVES **********************/
  204.  
  205.  
  206.  
  207. struct external_reloc {
  208.   char r_vaddr[4];
  209.   char r_symndx[4];
  210.   char r_type[2];
  211. };
  212.  
  213.  
  214. #define RELOC struct external_reloc
  215. #define RELSZ 10
  216.  
  217. #define DEFAULT_DATA_SECTION_ALIGNMENT 4
  218. #define DEFAULT_BSS_SECTION_ALIGNMENT 4
  219. #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
  220. /* For new sections we havn't heard of before */
  221. #define DEFAULT_SECTION_ALIGNMENT 4
  222.